<!DOCTYPE html>
<html lang="en">
	<head>
		<include file="Index/head" />
		<script type="text/javascript" src="__PUBLIC__/birthday/birthday.js"></script>
	</head>

	<body>
		<include file="Index/header" />

		<div class="main-container" id="main-container">
			<script type="text/javascript">
				try{ace.settings.check('main-container' , 'fixed')}catch(e){}
			</script>

			<div class="main-container-inner">
				<a class="menu-toggler" id="menu-toggler" href="#">
					<span class="menu-text"></span>
				</a>

				<include file="Index/menu" />
				
				<div class="main-content">
					<include file="Index/nav" />

					<div class="page-content">
						
							<!-- /**
							 * 右侧页面begin
							 */ -->
						<div class="row">
							<div class="col-xs-12">
								<!-- PAGE CONTENT BEGINS -->

								<form class="form-horizontal" role="form" action="{:U('Admin/Promotion/add_promoter')}" method="POST" enctype="multipart/form-data">
								<div class="space-4"></div>
								<div class="space-4"></div>
									<div class="form-group">
										<label class="col-sm-3 control-label no-padding-right" for="form-field-1"> 推广人: </label>
										<div class="col-sm-9">
											<input type="text" name="promoter" id="form-field-1" placeholder="推广人" class="col-xs-10 col-sm-5" required="required">
										</div>
									</div>
									<div class="space-4"></div>
									<div class="space-4"></div>
									<div class="form-group">
										<label class="col-sm-3 control-label no-padding-right" for="form-field-1"> scene_str: </label>
										<div class="col-sm-9">
											<input type="text" class="col-xs-10 col-sm-5" required="required" id="scene_str" value="{$scene_str}">
										</div>
									</div>
									<div class="space-4"></div>
									<div class="form-group">
										<label class="col-sm-3 control-label no-padding-right" for="form-field-2"> 二维码: </label>
										<div class="col-sm-9">
											<img src="" id="qrcode_img" style="width:150px; height:150px;">
										</div>
									</div>
									<input type="text" id="msg" name="msg" hidden="hidden" />
									<input type="text" name="url" id="url" hidden="hidden" />
									<div class="space-4"></div>
									<div class="form-group">
										<label class="col-sm-3 control-label no-padding-right" for="form-field-2"></label>
										<div class="col-sm-9">
											<button id="create_qrcode" type="button">生成二维码</button>
										</div>
									</div>
									<div class="clearfix form-actions">
										<div class="col-md-offset-3 col-md-9">
											<button class="btn btn-info" type="submit">
												<i class="icon-ok bigger-110"></i>
												添加
											</button>									
										&nbsp; &nbsp; &nbsp;
										<a href="{:U('Admin/Promotion/promoter_lists')}">
											<button class="btn" type="button">
												<i class="icon-undo bigger-110"></i>
												返回
											</button>
										</a>
											
										</div>
									</div>

									<div class="hr hr-24"></div>

									</div><!-- /row -->

								</form>

						</div>
							<!-- /**
							 * 右侧页面end
							 */ -->
					</div><!-- /.page-content -->
				</div>

			</div><!-- /.main-container-inner -->

			<a href="#" id="btn-scroll-up" class="btn-scroll-up btn btn-sm btn-inverse">
				<i class="icon-double-angle-up icon-only bigger-110"></i>
			</a>
		</div><!-- /.main-container -->
<script type="text/javascript">
$(function () {
$.ms_DatePicker({
    YearSelector: ".sel_year",
    MonthSelector: ".sel_month",
    DaySelector: ".sel_day"
});
$.ms_DatePicker();
}); 

$(document).ready(function(){

	$("#create_qrcode").bind('click',function(){
		url = "{:U('Admin/Promotion/get_franchise_qrcode')}";
		var scene_str = $("#scene_str").val();
		// alert(scene_str); return;
		$.ajax({
			type:'post',
			url:url,
			data:{scene_str:scene_str},
			dataType:'json',
			success:function(data){
				// alert(data['qrcode_img']); return;
				var qrcode_img_url = data['qrcode_img'];
				$("#qrcode_img").attr('src',qrcode_img_url);
				var scene_str = data['scene_str'];
				$("#msg").val(scene_str);
				$("#url").val(qrcode_img_url);
			}
		});
	});
});

</script>
		<include file="Index/footer" />
	</body>
</html>
